<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

<head>
<c:if test="${sessionScope.loginMember == null }">
	<jsp:forward page="loginPage.sds"></jsp:forward>
</c:if>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>StepUp-Badge</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">

<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>

<body>

	<div id="wrapper">

		<!-- 사이드바 -->
		<nav class="navbar-default navbar-static-side" role="navigation">
			<div class="sidebar-collapse">
				<ul class="nav" id="side-menu">

					<li class="nav-header">
						<div class="dropdown profile-element">
							<span>
								<c:if test="${sessionScope.loginMember.mimage == null}">
									<img alt="image" class="img-circle"
									src="imgUpload/anonymous.jpg" width="160px"/>
								</c:if>
								<c:if test="${sessionScope.loginMember.mimage != null}">
									<img alt="image" class="img-circle"
									src="imgUpload/${sessionScope.loginMember.mimage}" width="160px"/>
								</c:if>
							</span> <a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<span class="clear"> <span class="block m-t-xs"> <strong
										class="font-bold">${sessionScope.loginMember.mname}</strong>
								</span> <span class="text-muted text-xs block">
									${sessionScope.loginMember.mposition}
								<b class="caret"></b>
								</span>
							</span>
							</a>
							<ul class="dropdown-menu animated fadeInRight m-t-xs">
								<li><a href="stepup_profile.sds">Profile</a></li>
								<li class="divider"></li>
								<li><a href="logout.sds">Logout</a></li>
							</ul>
						</div>
					</li>

					<!-- 메뉴 리스트 -->
					<li><a href="index.sds"><i
							class="fa fa-bar-chart-o"></i> <span class="nav-label">Statistics</span></a></li>
					<li><a href="stepup_rank.sds"><i class="fa fa-flask"></i>
							<span class="nav-label">Ranking</span></a></li>
					<li class="active"><a href="stepup_badge.sds"><i class="fa fa-desktop"></i>
							<span class="nav-label">Badge</span></a></li>
					<li><a href="stepup_mission.sds"><i
							class="fa fa-envelope"></i> <span class="nav-label">Mission</span></a></li>
					<li><a href="stepup_temp.sds"><i class="fa fa-sitemap"></i>
							<span class="nav-label">Thermometer</span></a></li>
					<li><a href="stepup_donation.sds"><i class="fa fa-globe"></i>
							<span class="nav-label">Donation</span></a></li>
				</ul>
			</div>
		</nav>

		<div id="page-wrapper" class="gray-bg">

			<!-- 상단 메뉴 바 -->
			<div class="row border-bottom">
				<nav class="navbar navbar-static-top" role="navigation"
					style="margin-bottom: 0">
					<div class="navbar-header">
						<a class="navbar-minimalize minimalize-styl-2 btn btn-primary "
							href="#"><i class="fa fa-bars"></i> </a>
						<form role="search" class="navbar-form-custom" method="post"
							action="search_results.html">
							<div class="form-group">
								<input type="text" placeholder="Search for something..."
									class="form-control" name="top-search" id="top-search">
							</div>
						</form>
					</div>

					<!-- 상단 메뉴 - 검색, 로그아웃 포함 -->
					<ul class="nav navbar-top-links navbar-right">
						
						<!-- 상단: 로그인, 로그아웃 버튼 -->
						<c:if test="${sessionScope.loginMember != null}">
							<li><a href="stepup_profile.sds"><i class="fa fa-sign-out"></i>
								Profile
							</a></li>
							<li><a href="logout.sds"> <i class="fa fa-sign-out"></i>
								Logout
							</a></li>
						</c:if>
					</ul>
				</nav>
			</div>

			<!-- 메인 페이지 : 제목 -->
			<div class="row wrapper border-bottom white-bg page-heading">
				<div class="col-lg-9">
					<h2>내 뱃지</h2>
					<ol class="breadcrumb">
						<li>Home</li>
						<li>메뉴</li>
						<li class="active"><strong>뱃지</strong></li>
					</ol>
				</div>
				<div style="padding: 20px 30px 0px 0px">
					<img alt="image" class="img-responsive" src="img/logo.jpg"
					 style="Height: 80px; width: 80px;" align="right"  >
				</div>
			</div>


			<!-- 뱃지 리스트 보기 -->
			<div class="wrapper wrapper-content animated fadeInRight">
				<div class="row" id="showbadge">
				</div>
			</div>

			<div class="container">
				<div id="badgedetail">
					<div class='modal fade' id='myModal' tabindex='-1' role='dialog'
						aria-labelledby='myModalLabel' aria-hidden='true'>
						<div class='modal-dialog'>
							<div class='modal-content'>
								<div class='modal-header'>
									<button type='button' class='close' data-dismiss='modal'>
										<span aria-hidden='true'>&times;</span><span class='sr-only'></span>
									</button>
									<h4 class='modal-title' id='myModalLabel'>제목</h4>
								</div>
								<div class='modal-body'>
									<p>
									<div class='form-group'>
										<label for='Name' id='myModalContent'>내용</label>
									</div>
									</p>
								</div>
								<div class='modal-footer'>
									<button type='button' class='btn btn-default'
										data-dismiss='modal'>닫기</button>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="footer">
					<div align="right">
						StepUp System. Copyright <strong> &copy; SHINHAN DATA SYSTEM.</strong> All Right Reserved. 2015.
					</div>
				</div>

			</div>
		</div>

		<!-- Mainly scripts -->
		<script src="js/jquery-2.1.1.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
		<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

		<!-- Custom and plugin javascript -->
		<script src="js/inspinia.js"></script>
		<script src="js/plugins/pace/pace.min.js"></script>

		<script type="text/javascript">
			/* 	 $(document).ready(function() {
				 var bnameAry = [];
				var bimageAry = [];
				$('.contact-box').each(function() {
					animationHover(this, 'pulse');
				}); */
				 
				$(document).ready(function() {
					$.ajax({
						url : "allbadge.sds",
						type : "post",
						dataType : "json",
						async : false,
						success : function(data) {
							
							if(data.length == 0){
								$("#showbadge").append("보유중인 배지가 없습니다.");
							}else{
							
								var i;
								
								$.each(data, function(index, value) {
									
									i = index+1;
									
									$("#showbadge").append(
											"<div class='col-lg-3'>"+
											"<div class='contact-box'>"+
												"<a href='#myModal"+i+"' data-toggle='modal'>"+
													"<div class='col-sm-12'>"+
														"<div class='text-center'>"+
															"<h3>"+value.bgname+"</h3>"+
															"<div class='m-t-xs font-bold'>May 08, 2014</div>"+
																"<img alt='image' class='fancybox m-t-xs' style='width: 150px' src='img/badge"+i+".jpg'>"+
														"</div>"+
													"</div>"+
													"<div class='clearfix'>"+"</div>"+
												"</a>"+
											"</div>"+
										"</div>"
									);
									
									$("#badgedetail").append(
											"<div class='modal fade' id='myModal"+i+"' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>"+
												"<div class='modal-dialog'>"+
													"<div class='modal-content'>"+
														"<div class='modal-header'>"+
															"<button type='button' class='close' data-dismiss='modal'>"+
																"<span aria-hidden='true'>"+"&times;"+"</span>"+"<span class='sr-only'>"+"Close"+"</span>"+
															"</button>"+
															"<h4 class='modal-title' id='myModalLabel'>"+value.bgname+"</h4>"+
														"</div>"+
														"<div class='modal-body'>"+
															"<p>"+
															"<div class='form-group'>"+
																"<label for='Name'>"+value.bgdetail+"</label>"+
															"</div>"+
															"</p>"+
														"</div>"+
														"<div class='modal-footer'>"+
															"<button type='button' class='btn btn-default' data-dismiss='modal'>"+"닫기"+"</button>"+
														"</div>"+
													"</div>"+
												"</div>"+
											"</div>"
											);
								});
						}
						}
					});
				});
</script>

</body>

</html>
